package Filter;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        Person person=new Person("admin",GenderEnum.M,"0");
        Person person1=new Person("java",GenderEnum.M,"1");
        Person person2=new Person("ckens",GenderEnum.F,"0");
        Person person3=new Person("jurse",GenderEnum.F,"1");
        Person person4=new Person("cose",GenderEnum.F,"1");
        Person person5=new Person("perp",GenderEnum.M,"0");
        List<Person> people=new ArrayList<>();
        people.add(person);
        people.add(person1);
        people.add(person2);
        people.add(person3);
        people.add(person4);
        people.add(person5);
        Criteria single=new SingleCriteria();
        Criteria male=new MaleCriteria();
        people=single.meetCriteria(people);
        people.forEach(System.out::println);
        System.out.println("=========分割线==========");
        people=male.meetCriteria(people);
        people.forEach(System.out::println);
        System.out.println("=========分割线==========");
        people.clear();
        people.add(person);
        people.add(person1);
        people.add(person2);
        people.add(person3);
        people.add(person4);
        people.add(person5);
        Criteria andCriteria=new AndCriteria(single,male);
        people=andCriteria.meetCriteria(people);
        people.forEach(System.out::println);
        System.out.println("=========分割线==========");
        people.clear();
        people.add(person);
        people.add(person1);
        people.add(person2);
        people.add(person3);
        people.add(person4);
        people.add(person5);
        Criteria orCriteria=new OrCriteria(single,male);
        people=orCriteria.meetCriteria(people);
        people.forEach(System.out::println);
    }
}
